﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace EQual.MainModule.Projects.DetailsViews
{
    /// <summary>
    /// Interaction logic for ProjectDetailsView.xaml
    /// </summary>
    public partial class ProjectDetailsView : UserControl
    {
        public ProjectDetailsView()
        {
            InitializeComponent();
        }

        object _activeItem;

        public object ActiveItem
        {
            get { return _activeItem; }

            set
            {
                _activeItem = value;

                this.DataContext = new
                {
                    SelectedItem = value,
                    ProjectOwner = projectowner(value)
                };
            }
        }

        private  DataAccesLayer.Employee projectowner(object value)
        {
            if (!(value is DataAccesLayer.Project)) return null;
            if (((DataAccesLayer.Project)value).Employee == null)
                return ((DataAccesLayer.Project)value).Employee;
            else return null;
        }

        private void comboBox1_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {

        }
    }
}
